package cat.joronya.supermanager.team;

import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

public class ActionProgressDialogFragment extends DialogFragment
{
	public static ActionProgressDialogFragment newInstance(String message, boolean cancelable)
	{
		ActionProgressDialogFragment frag = new ActionProgressDialogFragment();
		Bundle args = new Bundle();
        args.putString("cat.joronya.supermanager.myteams.progress", message);
        args.putBoolean("cat.joronya.supermanager.myteams.cancelable", cancelable);
        frag.setArguments(args);
        return frag;
	}
	
	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) 
	{
		ProgressDialog progress = null;
		
		String message = getArguments().getString("cat.joronya.supermanager.myteams.progress");
		boolean cancelable = getArguments().getBoolean("cat.joronya.supermanager.myteams.cancelable");
		progress = ProgressDialog.show(getActivity(), "", message, true);
		progress.setCancelable(cancelable);
		
		return progress;
	}
}
